package com.hzit.manager.client.factory;

import com.hzit.manager.client.UserClient;
import com.hzit.util.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

@Component
public class HzitFeignFallbackFactory implements FallbackFactory<UserClient> {
	@Override
	public UserClient create(Throwable cause) {
		return new UserClient() {
			@Override
			public R list() {
				return R.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(),"用户服务异常(使用fallbackFactory进行熔断处理).");
			}
		};
	}
}
